<?php require VIEWPATH . ADMIN_DIR . DIRECTORY_SEPARATOR . 'header.php' ?>
<style type="text/css">
    th {
		text-align: center;
		background-color: #3DA4FF;
		color: white;
	}
    td {
        text-align: center;
		vertical-align: middle;
    }
    .outer {
        display: flex;
        margin: 10px 0 0 20px;
    }
    .subject {
        font-size: 1.6vw;
        font-family: 宋体;
        font-weight: bold;
        text-align: center;
        margin-bottom: 2vh;
        margin-top: 1vh;
    }
    .table-info {
        font-size: 0.9vw;
    }
    /* .table-info tr td:nth-child(1) {
        color: #3DA4FF;
    } */
    .table-seat {
        font-size: 0.8vw;
    }
    table.table-seat tbody {
        display:block;
        max-height:52.4vh;
        overflow-y:scroll;
    }
    table.table-seat thead, tbody tr {
        display:table;
        width:100%;
        table-layout:fixed;
    }
    .th-name {
        border-right: none !important;
    }
    .th-blank {
        width: 1.88%;
        border-left: none !important;
    }
    .footer {
        padding-top: 0px;
    }
    .btn-exam {
        border-radius: 20px;
        font-size: 1vw;
        padding: 2px 0;
        color: #3DA4FF;
        border: 2px solid #3DA4FF;
        text-align: center;
    }
    .btn-jump {
        display: flex;
        justify-content: space-around;
        width:80%;
        margin: 30px auto;
    }
</style>
<div class="page-header">
	<h1 style="font-size: 20px;">
        <a class="a-back" href="<?= admin_url('contents/exam') ?>">
            <i class="fa fa-reply"></i>
        </a>
        考场座位表
    </h1>
</div>
<?php if(empty($data) === true): ?>
    <div class="col-xs-11" style="font-size: 20px;text-align:center;margin-top: 60px;color: #A8A8A8;">暂无考场数据，请前往添加</div>
<?php else: ?>
    <?php if(isset($data['students']) || (isset($data['type']) && $data['type'] !== transform_exam_type_to_chinese(EXAM_TYPE_SELF))): ?>
    <div class="outer">
        <div class="col-xs-4">
            <div class="subject">
                <?= $data['lesson_name'] ?>
            </div>
            <table class="table-info table table-bordered table-hover">
                <thead></thead>
                <tbody>
                    <tr>
                        <td width="40%">考试类型</td>
                        <td>
                            <?php if(isset($data['type'])): ?>
                                <?= $data['type'] ?>
                            <?php endif ?>    
                        </td>
                    </tr>
                    <tr>
                        <td width="40%">考场名称</td>
                        <td>
                            <?php if(isset($data['room_name'])): ?>
                                <?= $data['room_name'] ?>
                            <?php endif ?>           
                        </td>
                    </tr>
                    <tr>
                        <td width="40%">考试日期</td>
                        <td><?= $data['day'] ?>（<?= $data['week'] ?>）</td>
                    </tr>
                    <tr>
                        <td width="40%">考试时间</td>
                        <td>
                            <?= $data['begin'] ?>
                            -
                            <?= $data['end'] ?>
                        </td>
                    </tr>
                    <tr>
                        <td width="40%">考试位置</td>
                        <td>
                            <?php if(isset($data['location'])): ?>
                                <?= $data['location'] ?>
                            <?php endif ?>    
                        </td>
                    </tr>
                    <tr>
                        <td width="40%">监考老师</td>
                        <td>
                            <?php if(isset($data['inside_teachers'])): ?>
                                <?= $data['inside_teachers'] ?>
                            <?php endif ?>    
                        </td>
                    </tr>
                </tbody>
            </table>
            <div class='btn-jump'>
                <?php if($data['last']): ?>
                    <div class='col-xs-3 btn-exam'>
                        <a href="<?=admin_url('contents/exam_room/') . $data['last']['room_id'] . '/' . $data['last']['detail_id'] ?>">上一场</a>
                    </div>
                <?php endif ?>
                <?php if($data['next']): ?>
                    <div class='col-xs-3 btn-exam'>
                        <a href="<?=admin_url('contents/exam_room/') . $data['next']['room_id'] . '/' . $data['next']['detail_id'] ?>">下一场</a>
                    </div>               
                <?php endif ?>       
            </div>
        </div>
        <div class="col-xs-7 div-seat">
            <?php if($data['students']): ?>
                <table class="table-seat table table-bordered table-hover">
                    <thead >
                        <th>座位</th>
                        <th>行政班</th>
                        <th>学生账号（教育ID）</th>
                        <th width="29.4%">准考证号</th>
                        <th class="th-name">姓名</th>
                        <th class="th-blank"></th>
                    </thead>
                    <tbody>
                        <?php foreach($data['students'] as $student): ?>
                            <tr>
                                <td><?= $student['seatNO'] ?></td>
                                <td><?= $student['class_name'] ?></td>
                                <td><?= $student['userID'] ? $student['userID'] : '' ?></td>
                                <td width="30%"><?= $student['studentTicket'] ?></td>
                                <td><?= $student['name'] ?></td>
                            </tr>
                        <?php endforeach ?>   
                    </tbody>
                </table>
            <?php else: ?>
                <div class="col-xs-11" style="font-size: 20px;text-align:center;margin-top: 60px;color: #A8A8A8;">暂无考生数据，请前往添加</div>
            <?php endif ?> 
        </div>
    </div>
    <?php else: ?>
        <div class="col-xs-11" style="font-size: 20px;text-align:center;margin-top: 60px;color: #A8A8A8;">该场考试为自习类型，无考场信息</div>
    <?php endif ?>
<?php endif ?>
<?php require VIEWPATH . ADMIN_DIR . DIRECTORY_SEPARATOR . 'footer.php' ?>